Add Custom Metadata overlay for SDK groups and PropertyDefinition narrowing#101
Conversation
…rowing Stacked on #100 — relies on the transformer fix to produce path keys under /rest/api/index, which is what this overlay's targets are written against. - Groups all 5 Custom Metadata endpoints under indexing.customMetadata in generated SDKs and applies clean method names (upsert, delete, getSchema, upsertSchema, deleteSchema). - Introduces a CustomMetadataPropertyDefinition schema that exposes only name, propertyType, and skipIndexing, and re-points CustomMetadataSchema.metadataKeys.items to it. The shared PropertyDefinition schema (used by the Datasource / Custom Properties API) carries fields that are not relevant to Custom Metadata; we cannot strip them from PropertyDefinition itself without affecting the Indexing API surface. - Registers the overlay in both glean-api-specs and glean-indexing-api-specs. The Custom Metadata endpoints themselves are still x-internal: true upstream in scio. This overlay is a no-op until that flag is removed in Phase 2; landing it here ahead of time so the SDK shape is in place when GA flips. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
| # Introduce a Custom Metadata-specific PropertyDefinition schema that exposes only | ||
| # the fields applicable to Custom Metadata. The shared PropertyDefinition schema | ||
| # (used by the Datasource / Custom Properties API) carries fields like displayLabel, | ||
| # displayLabelPlural, uiOptions, hideUiFacet, uiFacetOrder, and group that are not | ||
| # relevant to Custom Metadata. We cannot strip those fields from PropertyDefinition | ||
| # itself without affecting the Indexing API surface, so we create a | ||
| # narrower schema scoped to Custom Metadata and re-point CustomMetadataSchema to it. |
There was a problem hiding this comment.
This makes sense, but it's unfortunate to need an overlay here.
I presume it's not feasible to change the upstream so that the type that is actually shared is one that has the common properties because the type is currently in use?
There was a problem hiding this comment.
It would be quite difficult to manage that since the upstream properties are used in a lot of places both internally and by external API users and having separate structs would require us to make a lot of updates to handle in internal indexing processors.
Additionally - for long term, we would ideally support the UI properties we are applies overlay for here for consistency but it hasn't been prioritized yet.
|
A few things worth flagging before this lands. 1. PR description is stale The body says:
That's no longer accurate as of today — 2. The Grepping the current source spec for any schema named - target: $["components"]["schemas"]["CustomMetadataSchema"]["properties"]["metadataKeys"]
update:
items:
$ref: "#/components/schemas/CustomMetadataPropertyDefinition"…has nothing to update. The new Could you confirm whether (a) upstream is going to add a real 3. Minor: no overlay test Not blocking, but |
Asserts that the five Custom Metadata operations exposed by the overlay end up under x-speakeasy-group: indexing.customMetadata with the expected x-speakeasy-name-override values, so a future overlay reorder or upstream schema rename surfaces as a test failure rather than silent SDK drift. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
@steve-calvert-glean Thanks for the details review 1. PR description 2. 3. Overlay smoke test One caveat worth flagging: the |
Three small fixes that follow from the Custom Metadata paths landing in the source spec with their own path-level server prefix: - overlays/custom-metadata-modifications-overlay.yaml: prettier autofix (single quotes for the $ref string). - tests/post_transform_smoke.test.js: allow `/rest/api/index/` in the base-prefix smoke test so the Custom Metadata path keys (`/rest/api/index/document/...`, `/rest/api/index/custom-metadata/...`) don't trip the prefix check. Without this, the post-transform smoke step in transform.yml fails after Speakeasy successfully regenerates, blocking the commit step and leaving overlayed_specs stale. - tests/source-spec-transformer.test.js: compute the expected basePath per path, mirroring the transformer's path-level-server logic. The previous version assumed every transformed path key was `globalBasePath + originalPath`, which broke once the Custom Metadata paths brought their own `/rest/api/index` server prefix. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The committed overlayed_specs/glean-merged-spec.yaml is still stale; the assertion will be added back in a follow-up PR once the regen pipeline produces a fresh merged spec on main. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
I have updated the upstream spec so I will raise a followup with the test instead - also updated the prefix test here to account for custom server |
|
If we can get that fix out ASAP that'd be ideal, @chinmaya-singal-glean. I'll make sure the site is fully updated then. |
@steve-calvert-glean it is already out - the spec on main is also updated in this repo. |
Summary
indexing.customMetadatain generated SDKs and applies clean method names (upsert,delete,getSchema,upsertSchema,deleteSchema).CustomMetadataPropertyDefinitionschema that exposes onlyname,propertyType, andskipIndexing, and re-pointsCustomMetadataSchema.metadataKeys.itemsto it. The sharedPropertyDefinitionschema (used by the Datasource / Custom Properties API) carries fields likedisplayLabel,displayLabelPlural,uiOptions,hideUiFacet,uiFacetOrder,groupthat are not relevant to Custom Metadata. We can't strip them fromPropertyDefinitionitself without affecting the Indexing API surface, so we narrow via a separate schema.glean-api-specsandglean-indexing-api-specs.Notes on activation
/document/{docId}/custom-metadata/{groupName}and/custom-metadata/schema/{groupName}) are now insource_specs/indexing.yamlupstream (source SHA503e49e8…), withoutx-internal: true. So this overlay takes effect immediately when merged.Test plan
pnpm test— locally verified the overlay file change.🤖 Generated with Claude Code